import Vue from 'vue'
import Router from 'vue-router'

// import Home from '@/views/Home'
// import Ad from '@/views/Ad'

const lazyLoading = (name) => (resolve) => require([`@/views/${name}.vue`], resolve)

Vue.use(Router)

export default new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      name: '闯奇贷',
      meta: {
        home: true // 是否是首页面
      },
      component: lazyLoading('Home')
    }, {
      path: '/tally',
      name: '记账',
      meta: {
        home: true // 是否是首页面
      },
      component: lazyLoading('Tally')
    }, {
      path: '/detail',
      name: '明细',
      meta: {
        home: true // 是否是首页面
      },
      component: lazyLoading('Detail')
    }, {
      path: '/discover',
      name: '发现',
      meta: {
        home: true // 是否是首页面
      },
      component: lazyLoading('Discover')
    }, {
      path: '/set',
      name: '设置',
      meta: {
        home: true // 是否是首页面
      },
      component: lazyLoading('Set')
    }, {
      path: '/setHelp',
      name: '帮助中心',
      component: lazyLoading('SetHelp')
    }, {
      path: '*',
      redirect: '/'
    }
  ]
})
